<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <include file="Public:header" />
   
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerButton.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerRadio.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerFilter.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="__PUBLIC__/lib/js/ligerui.expand.js" type="text/javascript"></script> 
   
    <script type="text/javascript">

    	var grid,mydialog;
    	var groupicon = "__PUBLIC__/lib/ligerUI/skins/icons/communication.gif";
        $(function ()
        {
            //工具栏按钮
            var toolbarOptions = {
            		 items: [
            		   <volist id="item" name="button" >
                  	       <neq name="item['name']|strtolower" value="public" >
                  	             <neq name="item['name']|strtolower" value="index" >
                  	                  <eq name="item['access']" value="1" >
                  	                      { text:"{$item['title']}",id:"{$item['name']}", click:toolbarBtnItemClick, img: "__ROOT__{$item['nodeicon']}" },{ line: true },
                  	                  </eq>
                  	             </neq>
                  	       </neq>
                  	  </volist>
                  	{ line: true } 
               ]
            };
        	grid =$("#maingrid").ligerGrid({
                columns: [
                { display: '登录帐号', name: 'account', align: 'left', width: 100, minWidth: 60 },
                { display: '称呼', name: 'nickname', minWidth: 120 },
                { display: '创建日期', name: 'create_time', minWidth: 140,type: 'date',render:function (rowdata, rowindex, value){return DateFormat(value,"yyyy-MM-dd ");} },
                { display: '上次登录', name: 'last_login_time',type: 'date',render:function (rowdata, rowindex, value){return DateFormat(value,"yyyy-MM-dd hh:mm:ss");} },
                { display: '登录次数', name: 'login_count' },
                { display: '状态', name: 'status',render:function (row){return (row.status ==true)?'<img src="__PUBLIC__/lib/ligerui/skins/icons/ok.gif">':'<img src="__PUBLIC__/lib/ligerui/skins/icons/lock.gif">';} }
                ], 
                url:'__URL__/getlist/',dataAction:"server", pageSize:30 ,rownumbers:true,height:'100%',
                toolbar:toolbarOptions
            });
        	  $("#pageloading").hide();
        	  //搜索表单应用ligerui样式
            $("#formsearch").ligerForm({
      		   fields:[{display:"帐户",name:"account",newline:false,labelWidth:100,width:220,space:30,type:"text",cssClass:"field"},{display:"称呼",name:"nickname",newline:false,labelWidth:100,width:220,space:30,type:"text",cssClass:"field"}],
      		   toJSON: JSON2.stringify
      	     });

            //增加搜索按钮,并创建事件
            LG.appendSearchButtons("#formsearch", grid);

          
        });
        
      //工具条事件
        function toolbarBtnItemClick(item) {
            switch (item.id) {
                case "add":
                	mydialog=$.ligerDialog.open({ url: '__URL__/add/', height: 400, width: 400,
                      	buttons: [{ text: '确定', onclick: function (item, dialog) {save(dialog); } },
                                    { text: '取消', onclick: function (item, dialog) { dialog.close(); } }],
                                    isResize: true,isHidden:false
                   });
                    break;
                case "edit":
                	var selected = grid.getSelected();
                    if (!selected) { $.ligerDialog.warn('请选择行!'); return }
                    mydialog=$.ligerDialog.open({ url: '__URL__/edit/id/'+selected.id,name:'userwin',title:'编辑用户信息', height: 400, width: 500,
                    	buttons: [{ text: '确定', onclick: function (item, dialog) {save(dialog); } },
                                  { text: '取消', onclick: function (item, dialog) { dialog.close(); } }],
                                  isResize: true,isHidden:false
                 });
                    break;
                case "del":
                    del();
                    break;
                default:{
                	LG.tip("此方法没有定义,联系管理员设定按钮权限!");
                }
            }
        }
        
        function del(item)
        {
        	var selected = grid.getSelected();
            if (!selected) { $.ligerDialog.warn('请选择行!'); return }
            $.ligerDialog.confirm('是否真的删除此记录:'+selected .name, function (yes){
            	if(yes){
       					$.get("__URL__/del/",{"id":selected.id},function(data){
       						grid.loadData();
       						alert($.parseJSON(data).info);
       						});
           				}
              });
        }
        function save(dialog)
        {
        	var data = dialog.frame.f_save(); //|| dialog.frame.window.f_subset; 
        	
        }
    </script>
</head>

<body style="overflow-x:hidden; padding:2px;">
	<div class="l-loading" style="display:block" id="pageloading"></div>
 	<div class="l-clear"></div>
    
 	 <div id="mainsearch" style="width:98%">
    		<div class="searchtitle">
    			<span>搜索</span><img src="__PUBLIC__/lib/icons/32X32/searchtool.gif" />
        		<div class="togglebtn"></div> 
    		</div>
   			 <div class="navline" style="margin-bottom:4px; margin-top:4px;"></div>
    		<div class="searchbox">
        		<form id="formsearch" class="l-form"></form>
    		</div>
  	</div>
  	<div class="l-clear"></div>
    <div id="maingrid"></div>
            	

        	 <volist id="item" name="button" >
        	       <neq name="item['name']|strtolower" value="public" >
        	             <neq name="item['name']|strtolower" value="index" >
        	                  <eq name="item['access']" value="1" >
        	                      { text: {$item['title']}, click: {$item['name']}, img: '__ROOT__'+{$item['nodeicon']} }
        	                    
        	                  </eq>
        	             </neq>
        	       </neq>
        	  </volist>
  <div style="display:none;"></div>
 
</body>
</html>
